package com.universalInterface;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Arrays;

@Slf4j
@SpringBootApplication
@MapperScan(value = "com.universalInterface.lims_interface.mapper") // 扫描mapper
@EnableTransactionManagement    // 开启事务
public class LimsinterfaceApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(LimsinterfaceApplication.class, args);
        String[] profiles = run.getEnvironment().getActiveProfiles();
        String port = run.getEnvironment().getProperty("server.port");
        port = StrUtil.isNotBlank(port) ? port : "8080";
        String url = run.getEnvironment().getProperty("spring.datasource.url");
        String name = run.getEnvironment().getProperty("spring.application.name");

        log.info("----------------- {}", url);
        log.info("-----------------");
        log.info("{} - {} 系统启动成功，访问地址：http://127.0.0.1:{}/index", name, Arrays.toString(profiles), port);
        log.info("{} - {} 系统启动成功，接口文档地址：http://127.0.0.1:{}/doc.html", name, Arrays.toString(profiles), port);
    }

}
